﻿namespace Services.Interface;

/// <summary>
/// 角色服务层接口
/// </summary>
public partial interface IRoleBLL : IBaseBLL<Role>
{
    /// <summary>
    /// 所有角色
    /// </summary>
    /// <returns></returns>
    Task<List<Role>> GetAllAsync(Expression<Func<Role, bool>>? whereExpression = null);
    /// <summary>
    /// 获取角色
    /// </summary>
    /// <param name="roleid"></param>
    /// <returns></returns>
    Task<Role> GetRoleByIdAsync(int roleid);
    /// <summary>
    /// 获取角色下拉值
    /// </summary>
    /// <returns></returns>
    Task<List<Role>> GetDownListAsync();
    /// <summary>
    /// 获取角色列表
    /// </summary>
    /// <returns></returns>
    Task<List<RoleVM>> GetPageListAsync(RolePageQueryRM queryRM);
    /// <summary>
    /// 根据角色Id获取功能权限列表
    /// </summary>
    /// <param name="roleId"></param>
    /// <returns></returns>
    Task<List<Feature>> GetFeatureListByRoleIdAsync(int roleId);

    Task<List<FeatureTree>> GetRoleFeatureTreesAsync(int roleId);
    /// <summary>
    /// 获取功能树
    /// </summary>
    /// <returns></returns>
    Task<List<FeatureTree>> GetFeatureTreesAsync(int roleId);

    /// <summary>
    /// 新增
    /// </summary>
    /// <param name="createRM"></param>
    /// <returns></returns>
    Task<ResultModel> AddAsync(RoleCreateRM createRM);

    /// <summary>
    /// 更新
    /// </summary>
    /// <param name="updateRM"></param>
    /// <returns></returns>
    Task<ResultModel> UpdateAsync(RoleUpdateRM updateRM);

    /// <summary>
    /// 删除
    /// </summary>
    /// <param name="id"></param>
    Task<string> DeleteByIdAsync(int id);

    /// <summary>
    /// 设置角色状态
    /// </summary>
    /// <param name="rm"></param>
    Task<ResultModel> SetRoleEnableByIdsAsync(SetEnableRM rm);

    /// <summary>
    /// 查询已授权用户
    /// </summary>
    /// <returns></returns>
    Task<List<SelectedUserVM>> GetAssociatedUserByRoleIdAsync(int roleId);

    /// <summary>
    /// 获取角色详情
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    Task<RoleDetailVM> GetDetail(int id);

    /// <summary>
    /// 关联用户
    /// </summary>
    /// <param name="updateRM"></param>
    /// <returns></returns>
    Task<ResultModel> BindUser(BindUserRM updateRM);
}
